
set(BUILD_SHARED_LIBS 1)

include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})

if (WIN32)
    add_definitions(-DIMAGE_CODEC_EXPORTS)
endif ()

set(JPEGSupport libjpegSupport/JPEGBit.h libjpegSupport/JPEGBit.cpp libjpegSupport/JPEGCodec12.cpp libjpegSupport/JPEGCodec16.cpp libjpegSupport/JPEGPlus.cpp LibJpegCodec.cpp )
add_library(ImageCodec ImageCodec.h ImageCodec.cpp LibJpegCodec.h LibJpegCodec.cpp LibCharlsCodec.cpp LibCharlsCodec.h ${JPEGSupport})
target_link_libraries(ImageCodec jpeg16 jpeg12 jpeg8 charls)

set(JPEG_INSTALL_BIN_DIR .)
set(JPEG_INSTALL_LIB_DIR .)


if (WIN32)
    install(TARGETS ImageCodec
            EXPORT ImageCodec
            RUNTIME DESTINATION ${JPEG_INSTALL_BIN_DIR} COMPONENT Applications
            #LIBRARY DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT Libraries ${NAMELINK_SKIP}
            #ARCHIVE DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT DebugDevel
            )
else ()
    install(TARGETS ImageCodec
            EXPORT ImageCodec
            #RUNTIME DESTINATION ${JPEG_INSTALL_BIN_DIR} COMPONENT Applications
            LIBRARY DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT Libraries ${NAMELINK_SKIP}
            #ARCHIVE DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT DebugDevel
            )
endif ()

add_executable(ImageCodecTest main.cpp)
target_link_libraries(ImageCodecTest  ImageCodec)


